{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "b0a9f40e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import collections\n",
    "import itertools\n",
    "import math\n",
    "from typing import List\n",
    "# import tensorflow as tf\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "69643705",
   "metadata": {},
   "outputs": [],
   "source": [
    "SSDBoxSizes = collections.namedtuple('SSDBoxSizes', ['min', 'max'])\n",
    "\n",
    "SSDSpec = collections.namedtuple('SSDSpec', ['feature_map_size', 'shrinkage', 'box_sizes', 'aspect_ratios'])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "fa7fa543",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "SSDSpec(feature_map_size=1, shrinkage=2, box_sizes=3, aspect_ratios=4)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "SSDSpec._make([1,2,3,4])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "2a5466e9",
   "metadata": {},
   "outputs": [
    {
     "ename": "error",
     "evalue": "OpenCV(4.5.3) C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-req-build-sn_xpupm\\opencv\\modules\\highgui\\src\\window_w32.cpp:1246: error: (-27:Null pointer) NULL window: 'test' in function 'cvDestroyWindow'\n",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31merror\u001b[0m                                     Traceback (most recent call last)",
      "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_29888/417219770.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m     13\u001b[0m \u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mimshow\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'test'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mimg\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     14\u001b[0m \u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwaitKey\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 15\u001b[1;33m \u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdestroyWindow\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'test'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31merror\u001b[0m: OpenCV(4.5.3) C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-req-build-sn_xpupm\\opencv\\modules\\highgui\\src\\window_w32.cpp:1246: error: (-27:Null pointer) NULL window: 'test' in function 'cvDestroyWindow'\n"
     ]
    }
   ],
   "source": [
    "import cv2\n",
    "import numpy as np\n",
    "\n",
    "# 图片的分辨率为200*300，这里b, g, r设为随机值，注意dtype属性\n",
    "b = np.random.randint(0, 255, (300, 300,3), dtype=np.uint8)\n",
    "g = np.random.randint(0, 255, (200, 300), dtype=np.uint8)\n",
    "r = np.random.randint(0, 255, (200, 300), dtype=np.uint8)\n",
    "\n",
    "# 合并通道，形成图片\n",
    "img = cv2.merge([b, g, r])\n",
    "\n",
    "# 显示图片\n",
    "cv2.imshow('test', img)\n",
    "cv2.waitKey(0)\n",
    "cv2.destroyWindow('test')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "d8ecaed4",
   "metadata": {},
   "outputs": [
    {
     "ename": "error",
     "evalue": "OpenCV(4.5.3) C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-req-build-sn_xpupm\\opencv\\modules\\highgui\\src\\window_w32.cpp:1246: error: (-27:Null pointer) NULL window: 'test' in function 'cvDestroyWindow'\n",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31merror\u001b[0m                                     Traceback (most recent call last)",
      "\u001b[1;32m~\\AppData\\Local\\Temp/ipykernel_29888/2750653272.py\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      6\u001b[0m \u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mimshow\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'test'\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mimg\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      7\u001b[0m \u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mwaitKey\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 8\u001b[1;33m \u001b[0mcv2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdestroyWindow\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m'test'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31merror\u001b[0m: OpenCV(4.5.3) C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pip-req-build-sn_xpupm\\opencv\\modules\\highgui\\src\\window_w32.cpp:1246: error: (-27:Null pointer) NULL window: 'test' in function 'cvDestroyWindow'\n"
     ]
    }
   ],
   "source": [
    "import numpy as np, cv2\n",
    "vis = np.zeros((320, 320,3), np.uint8)\n",
    "vis[:,235,:]=128\n",
    "img = cv2.cvtColor(vis,cv2.COLOR_RGB2BGR)\n",
    "# 显示图片\n",
    "cv2.imshow('test', img)\n",
    "cv2.waitKey(0)\n",
    "cv2.destroyWindow('test')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "15237417",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
